package com.java;

/**
 * 构造函数
 */
public class Constructor {
    private String name;
    
    // 无参构造
    public Constructor() {}
    
    // 有参构造
    public Constructor(String name) {
        this.name = name;
    }
    
    public static void main(String[] args) {
        // 无参构造
        Constructor ins1 = new Constructor();
        System.out.println(ins1.name); // null
        
        // 有参构造
        Constructor ins2 = new Constructor("SYX");
        System.out.println(ins2.name); // SYX
    }
}
